﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FilterIllegalCharacter.Core
{
    public static class CheckSpecial
    {
        public static bool CheckSpecialSym(char character)
        {
            return !IsCHS(character) && !IsNum(character) && !IsAlphabet(character);
        }

        public static bool IsCHS(char character)
        {
            //  中文表意字符的范围 4E00-9FA5  
            int charVal = (int)character;
            return (charVal >= 0x4e00 && charVal <= 0x9fa5);
        }

        public static bool IsNum(char character)
        {
            int charVal = (int)character;
            return (charVal >= 48 && charVal <= 57);
        }

        public static bool IsAlphabet(char character)
        {
            int charVal = (int)character;
            return ((charVal >= 97 && charVal <= 122) || (charVal >= 65 && charVal <= 90));
        }
    }
}
